import axios from "axios";

const service = axios.create({
  baseURL: process.env.VUE_APP_URL,
  // 请求超时时间
  timeout: 1000 * 60 * 5,
});

// 添加请求拦截器
service.interceptors.request.use(
  (config) => {
    console.log(process.env.VUE_APP_URL);
    console.log("config:", config);
    return config;
  },
  (err) => Promise.reject(err)
);

// 添加响应拦截器
service.interceptors.response.use(
  (response) => {
    console.log("response:", response);
    return response;
  },
  (err) => Promise.reject(err)
);

export default service;
